﻿<UserControl x:Class="ShowMultiple.Plugin.ShowMultipleImagesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:y="clr-namespace:ShowMultiple.Plugin"
             xmlns:wpfImage="clr-namespace:WpfImageDuplicates;assembly=WpfImageDuplicates"
             xmlns:dragdrop="clr-namespace:DragDropLibrary;assembly=DragAndDrop"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d">
    <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="0.8*"/>
            <RowDefinition Height="0.2*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.5*"/>
            <ColumnDefinition Width="0.5*"/>
        </Grid.ColumnDefinitions>
        <!--dragdrop:DragAndDrop.DropEnabled="True"-->
        <ListBox Grid.ColumnSpan="2" Grid.Row="0" x:Name="lstItems" ItemsSource="{Binding}" SelectionMode="Extended" dragdrop:DragAndDrop.DragEnabled="True"                  
                 dragdrop:DragAndDrop.DropMethodName="DropCompleted"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" Padding="1,1,1,1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel x:Name="wrap" Loaded="wrap_Loaded"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible"
                               ItemWidth="240" ItemHeight="220"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="16"/>
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" Margin="2,2,2,2" BorderBrush="Black" BorderThickness="1,1,1,1" HorizontalAlignment="Stretch">
                            <wpfImage:ImageControl ImageSource="{Binding Path=ImageSource}" Tag="{Binding}" SizeChanged="imgMain1_SizeChanged" x:Name="imgMain1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto"
                                            MouseRightButtonDown="imgMain1_MouseRightButtonDown" />
                        </Border>
                        <TextBlock Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding FileName}"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <wpfImage:ShowAvailableFilters Grid.Row="1" x:Name="showAvailable" Grid.Column="1" WantAddFilter="showAvailable_WantAddFilter"/>
    </Grid>
</UserControl>
